home *** CD-ROM | disk | FTP | other *** search
- package asp.wizard;
-
- import asp.netobjects.nfx.util.ExceptionHandler;
- import asp.netobjects.nfx.util.ExternalError;
- import asp.netobjects.nfx.util.InternalError;
- import asp.netobjects.nfx.wizard.Wizard;
- import asp.netobjects.nfx.wizard.WizardPage;
- import asp.netobjects.nfx.wizard.WizardPageView;
- import asp.wizard.def.DefPage;
- import com.sun.java.swing.ImageIcon;
-
- public class WizardModelAbstract extends WizardPage {
- protected static final String IMG_DIR = "image";
- private DefPage _defPage;
- private int _templateId = -1;
- private boolean _skip = false;
-
- public WizardModelAbstract() {
- super((Wizard)null, (String)null, (String)null, (ImageIcon)null, (ExceptionHandler)null);
- super.dmIsLastPage = false;
- }
-
- public WizardModelAbstract(Wizard wizard, String bullet, String info, ImageIcon icon, ExceptionHandler handler) {
- super(wizard, bullet, info, icon, handler);
- super.dmIsLastPage = false;
- }
-
- protected WizardManager getWizardManager() {
- return (WizardManager)((WizardPage)this).getWizard();
- }
-
- public void createView() throws InternalError {
- super.dmWizardPageView = this.getViewSingleInstance();
- if (super.dmWizardPageView == null) {
- throw new InternalError(this.getClass().getName() + ".createView(): " + "getViewSingleInstance() " + "returned null");
- }
- }
-
- protected WizardPageView getViewSingleInstance() {
- return null;
- }
-
- public DefPage getDefPage() {
- return this._defPage;
- }
-
- public void setDefPage(DefPage defPage) {
- this._defPage = defPage;
- }
-
- public int getTemplateId() {
- return this._templateId;
- }
-
- void setTemplateId(int templateid) {
- this._templateId = templateid;
- }
-
- public WizardPage getNext() throws InternalError, ExternalError {
- WizardPage result = null;
- if (this.getWizardManager() != null) {
- WizardManager wizman = this.getWizardManager();
- if (wizman.isModelSkippingEnabled()) {
- WizardPage curr;
- for(curr = wizman.getNextModel(this); curr != null && ((WizardModelAbstract)curr).isSkip(); curr = wizman.getNextModel(curr)) {
- }
-
- result = curr;
- } else {
- result = wizman.getNextModel(this);
- }
- } else {
- result = super.getNext();
- }
-
- return result;
- }
-
- public WizardPage getPrevious() throws InternalError, ExternalError {
- WizardPage result = null;
- if (this.getWizardManager() != null) {
- WizardManager wizman = this.getWizardManager();
- if (wizman.isModelSkippingEnabled()) {
- WizardPage curr;
- for(curr = wizman.getPreviousModel(this); curr != null && ((WizardModelAbstract)curr).isSkip(); curr = wizman.getPreviousModel(curr)) {
- }
-
- result = curr;
- } else {
- result = wizman.getPreviousModel(this);
- }
- } else {
- result = super.getPrevious();
- }
-
- return result;
- }
-
- public String getBulletText() {
- return null;
- }
-
- public String getInfoText() {
- return null;
- }
-
- public void initialize(int direction) throws InternalError, ExternalError {
- if (((WizardPage)this).getView() != null) {
- ((WizardPage)this).getView().setModel(this);
- }
-
- if (((WizardPage)this).getView() != null && ((WizardPage)this).getWizard() != null) {
- ((WizardPage)this).getWizard().getView().addPageView(String.valueOf(((WizardPage)this).getId()), ((WizardPage)this).getView());
- }
-
- }
-
- public void loadView() {
- }
-
- public boolean isSkip() {
- return this._skip;
- }
-
- public void setSkip(boolean value) {
- this._skip = value;
- }
-
- public boolean isRegisteredWithWizard() {
- return !super.dmId.equals("");
- }
-
- public void validate() throws InternalError, ExternalError {
- this.commitView();
- }
-
- protected void commitView() {
- if (((WizardPage)this).getView() != null) {
- ((WizardViewAbstract)((WizardPage)this).getView()).commit();
- }
-
- }
- }
-